<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			//工厂模式
			//造一辆车 出厂 （合格证/建议零售价/说明书）
			function createCar(credential,price,direction){
				var obj=new Object();
				obj.credential=credential;
				obj.price=price;
				obj.direction=direction;
				obj.carShow=function(){
					alert("合格证："+this.credential+";"+"建议零售价："+this.price+";"+"说明书："+";"+this.direction);
				};
				return obj;
			}
			var person=createCar("合格了","100万","请看说明书");
			person.carShow();
			
			
			//1.工厂函数有return
			//2.工厂函数不需要new
			
		</script>
	</body>
</html>
